package com.my.chapter16;

public class practice1 {
    static void hide(BerylliumSphere[] s) {
        System.out.println("Hiding " + s.length + " sphere(s)");
    }

    public static void main(String[] args) {
        //动态聚集初始化
        hide(new BerylliumSphere[]{ new BerylliumSphere(),
                new BerylliumSphere() });

        //! hide({ new BerylliumSphere() });

        //普通的聚集初始化
        BerylliumSphere[] d = { new BerylliumSphere(),
                new BerylliumSphere(), new BerylliumSphere() };
        hide(d);

        BerylliumSphere[] a = new BerylliumSphere[]{
                new BerylliumSphere(), new BerylliumSphere() };
        hide(a);
    }
}

class BerylliumSphere{
    private static long counter;
    private final long id = counter++;

    @Override
    public String toString() {
        return "Sphere " + id;
    }
}
